<%@ page import="bean.UserInfo" %>
<%@ page import="java.util.List" %><%--
  Created by IntelliJ IDEA.
  User: yaclt
  Date: 2021/11/30 0030
  Time: 9:25
  To change this template use File | Settings | File Templates.
--%>
<%@ page contentType="text/html;charset=UTF-8" language="java" %>
<html>
<head>
    <title>Title</title>
    <link rel="stylesheet" href="/assets/css/bootstrap.min.css">
    <style>
        .container {
            width: 1000px;
            margin-top: 20px;
        }
    </style>
</head>
<body>
<div class="container">
    <table class="table table-bordered table-hover">
        <thead>
        <tr>
            <th>编号</th>
            <th>昵称</th>
            <th>账号</th>
            <th>头像</th>
            <th>邮箱</th>
            <th>创建时间</th>
            <th>操作</th>
        </tr>
        </thead>
        <tbody>
        <%
            List<UserInfo> list = (List<UserInfo>) request.getAttribute("allUser");
            for (UserInfo u : list) {
        %>
        <tr>
            <td><%=u.getId()%>
            </td>
            <td><%=u.getNickname()%>
            </td>
            <td><%=u.getAccount()%>
            </td>
            <td><%=u.getHeaderUrl()%>
            </td>
            <td><%=u.getEmail()%>
            </td>
            <td><%=u.getCreateTime()%>
            </td>
            <td>
                <a onclick="return confirm('确认删除?')" href="/cp7/user/delete?id=<%=u.getId()%>">删除</a>
                <a href="/cp7/user/modify?id=<%=u.getId()%>">修改</a>
            </td>
        </tr>
        <%}%>
        </tbody>
    </table>
    <div class="container" style="width: 400px">
        <h1>新增用户</h1>
        <form action="/cp7/user/save" method="post">
            <p class="form-group">
                <input type="text" required class="form-control" name="nickname" placeholder="昵称">
            </p>
            <p class="form-group">
                <input type="text" required class="form-control" name="account" placeholder="账号">
            </p>
            <p class="form-group">
                <input type="password" required class="form-control" name="password" placeholder="密码">
            </p>
            <p class="form-group">
                <input type="text" class="form-control" name="email" placeholder="邮箱">
            </p>
            <button type="submit" class="btn btn-primary btn-block">保存</button>
        </form>
    </div>
</div>
</body>
</html>
